package cn.pet.service.manage.mapper;

import cn.pet.service.manage.entity.PetComment;
import cn.pet.service.manage.entity.dto.CommentSearch;
import cn.pet.service.manage.entity.vo.CommentList;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 评论表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2023-02-11
 */
public interface PetCommentMapper extends BaseMapper<PetComment> {


    @Select("select a.*,b.real_name,c.name as goods_name from pet_comment a\n" +
            "left join pet_user b on a.user_id = b.id\n" +
            "left join pet_goods c on a.good_id = c.id where a.good_id = #{goodId}")
    List<CommentList> queryByGoodId(Integer goodId);

    List<CommentList> queryList(CommentSearch search);

}
